package com.weixing.mall.provider.controller.admin;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.core.support.auth.SysAuth;
import com.weixing.mall.core.support.auth.SysInfo;
import com.weixing.mall.provider.service.IOrderPCService;
import com.weixing.mall.provider.service.IOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @date 2020-4-3 11:50:25
 * @version 1.0
 */
@RestController
@RequestMapping("indexReport")
@Api(value = "后台首页统计", tags = "后台首页统计")
public class IndexReportController extends BaseController {

    @Autowired
    private IOrderService orderService;

    @Autowired
    private IOrderPCService orderPCService;
    @ApiOperation(value = "订单统计")
    @GetMapping("orderReport")
    public Result orderReport(){
        return ResultUtil.success(orderService.getAdminIndexOrderReport());
    }

    @ApiOperation(value = "销售统计")
    @GetMapping("orderSaleReport")
    public Result orderSaleReport(String startTime,String endTime){
        return ResultUtil.success(orderService.getAdminIndexSaleReport(startTime,endTime));
    }
    @ApiOperation(value = "代办事项")
    @GetMapping("agency")
    public Result agency(@SysInfo SysAuth auth){
        return ResultUtil.success(orderPCService.agency(auth.getUid()));
    }

}
